Source code for /engineering/webperf/slave-v4[j1.2]/SlaveUI.javaOriginal file SlaveUI.java
   1 import java.awt.*;
   2 import java.awt.event.*;
   3 import java.util.*;
   4 
   5 public class SlaveUI implements ActionListener {
   6  
   7    // UI Elements
   8    Frame	   f;
   9    TextArea    screenLog;
  10    TextField   currentScriptName;
  11    TextField   currentTarget;
  12    TextField   scriptTime;
  13    Button      buttonAllow;
  14    Button	   buttonDisallow;
  15    Panel	   panelButton;
  16    Panel 	   panelInfo;
  17  
  18    SlaveUI(Frame f) {
  19    
  20 	initialize(f);
  21    }
  22    
  23    private void initialize(Frame f) {  
  24 	
  25 	this.f = f;
  26 	f.setLayout(new BorderLayout());
  27 	f.setTitle("JF Performance Test Tool - SLAVE");
  28       
  29       // Build UI
  30 	screenLog 	      = new TextArea("Started...\n\n");
  31       currentScriptName = new TextField("!!NO SCRIPT LOADED!!");
  32       currentTarget     = new TextField("!!NO TARGET SPECIFIED!!");
  33 	scriptTime		= new TextField("0",12);
  34 	panelButton	   = new Panel();
  35 	panelInfo	   = new Panel();
  36 	buttonAllow    = new Button("Allow");
  37 	buttonDisallow = new Button("Disallow");
  38 
  39 	currentScriptName.setEditable(false);
  40 	screenLog.setEditable(false);
  41 	scriptTime.setEditable(false);
  42 	currentTarget.setEditable(false);
  43 
  44 	// build top panal
  45 	panelInfo.setLayout(new BorderLayout());
  46 	panelInfo.add(currentScriptName, "North");
  47 	panelInfo.add(currentTarget, "Center");
  48 	panelInfo.add(scriptTime, "East");
  49      	f.add(panelInfo, "North");
  50 
  51 	// build center log area
  52 	f.add(screenLog, "Center");
  53 
  54 	// build bottom button panal
  55 	panelButton.setLayout(new FlowLayout(FlowLayout.LEFT));
  56 	panelButton.add(buttonAllow);
  57 	panelButton.add(buttonDisallow);
  58 	buttonAllow.addActionListener(this);
  59 	buttonDisallow.addActionListener(this);	
  60 	f.add(panelButton, "South");
  61 	
  62 	f.setSize(550,580);
  63 	f.show();
  64 	      
  65    }
  66    
  67    public void actionPerformed(ActionEvent  e) {
  68  
  69 	if(e.getSource() == buttonAllow) {
  70 	   screenLog.append("Set ALLOW.\n");
  71 
  72 	}
  73 	else if (e.getSource() == buttonDisallow) {
  74 	   screenLog.append("Set DISALLOW.\n");
  75 
  76 	}
  77    }
  78 
  79    public void putScreenLog(String entry) {
  80 	screenLog.append(entry + "\n");
  81    }
  82 
  83    public void setTarget(String name) {
  84 	currentTarget.setText(name);
  85    }
  86 
  87    public void setScriptTime(String name) {
  88 	scriptTime.setText(name);
  89    }
  90 
  91    public void setScriptName(String name) {
  92 	currentScriptName.setText(name);
  93    }
  94 
  95 }